package org.me.adapter;

import java.util.ArrayList;

import org.jivesoftware.smack.util.StringUtils;
import org.me.R;
import org.me.R.id;
import org.me.R.layout;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class Adapter_MultiUserChat extends BaseAdapter{

	private int count;
	private Context context;
	private ArrayList<String> rooms;
//	private String user;

	public Adapter_MultiUserChat(Context context, ArrayList<String> rooms)
	{
		this.count = rooms.size();
		this.context = context;
		this.rooms = rooms;
//		this.user = user;
	}
	
	public void addItem(ArrayList<String> room1) {
    	this.rooms = room1;
    }
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return count;
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View contentView, ViewGroup parent) {
		// TODO Auto-generated method stub
		LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//		String name = StringUtils.parseName(Koneksi.getInstance().getConnection().getUser());
		contentView = inflater.inflate(R.layout.muc_list_layout, null);
		TextView title = (TextView)contentView.findViewById(R.id.muc_room);
		title.setText(rooms.get(position));
		
//System.out.println("message.get(position)= "+message.get(position));
		return contentView;
	}

}
